package com.apress.android;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.KeyEvent;

public class Pranker extends Activity {
	Intent g;
    /** Called when the activity is first created. */
	@Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        //setContentView(R.layout.main);
        Intent i = getIntent();
        String action = i.getAction();
        if (action != null && action.equals("com.apress.START_THE_MUSIC")) {
        	setContentView(R.layout.pranked);
        	//We'll need to start the music service here
        	g = new Intent("com.apress.START_AUDIO_SERVICE");
        	startService(g);
        } else
        	finish();
    }
	
	public boolean onKeyDown(int keyCode, KeyEvent event){
		stopService(g);
		finish();
		return true;
	}
}